<template>
	<view class="wrap">
		<view class="item u-flex u-p-10 u-border-bottom" v-for="item in listItem" @click="lookImg(item.childNutritionRecord,item.planName)">
			<p class="name">{{item.planName}}</p>
			<view class="grop u-flex">
				<p class="u-m-l-50" style="color: green;" v-if="item.childNutritionRecord.checkType==1">
					<u-icon name="checkmark-circle" color="green"></u-icon>
					已领取</p>
				<p class="u-m-l-50" style="color: red;" v-else>
					<u-icon name="close-circle" color="red"></u-icon>
					未领取</p>
			</view>
			<view class="right u-relative">
				<u-tag text="未上传" type="warning" v-if="item.childNutritionRecord.isUpload==0" />
				<u-tag text="已上传" type="success" v-else />
				<u-icon name="arrow-right" class="u-absolute rights" v-if="item.childNutritionRecord.checkType==1"></u-icon>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				listItem:[],
				checkbox: [{
						name: '0',
						disabled: false
					},
					{
						name: '1',
						disabled: false
					}
				],
			};
		},
		onShow() {
			this.getListInfo()
		},
		methods: {
			radioGroupChange(e) {
				console.log(e);
			},
			lookImg(obj,name) {
				console.log(obj,name)
				if(obj.checkType==1&&obj.isUpload==0||obj.isUpload==1){
					uni.navigateTo({
						url:`./child_bagSec?id=${obj.planId}&isUpload=${obj.isUpload}&title=${name}`
					})
				}else{
					uni.showToast({
						title:'你还未领取营养包',
						icon:'none'
					})
				}
			},
			getListInfo(){
				this.config.get('/flow/getNutritionPlan',{
					pageNum:1,
					pageSize:100
				}).then((res)=>{
					console.log(res)
					this.listItem = res.data.data.list
				})
			}

		}
	}
</script>

<style lang="scss">
	.name{
		width: 15%;
		text-align: center;
	}
	.item {
		height: 120rpx;
		align-items: center;
		justify-content: space-around;
	}
	.rights{
		top: 10rpx;
		right: -42rpx;
	}
</style>
